﻿<div style="width:600px;margin:0 auto;padding-top:20px;">
    <form class="layui-form" action="/eureka/update">
        <div class="layui-form-item">
            <label class="layui-form-label">应用名称</label>
            <div class="layui-input-block">
                <input type="text" name="name" win-verify="required" placeholder="请输入应用名称" autocomplete="off" class="layui-input" value="" readonly="readonly"/>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">实例名称</label>
            <div class="layui-input-block">
                <input type="text" name="instanceId" win-verify="required" placeholder="请输入实例名称" autocomplete="off" class="layui-input" value="" readonly="readonly"/>
            </div>
        </div>
        <div class="layui-form-item" pane>
            <label class="layui-form-label">菜单类型</label>
            <div class="layui-input-block winui-radio">
                <input type="radio" name="status" value="UP" title="UP" checked/>
                <input type="radio" name="status" value="DOWN" title="DOWN" />
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="winui-btn" lay-submit lay-filter="formEditMenu">确定</button>
                <button class="winui-btn" onclick="winui.window.close('editMenu'); return false;">取消</button>
            </div>
        </div>
    </form>
    <div class="tips">Tips：只可以修改节点状态</div>
</div>
<script>
    layui.use(['form'], function (form) {
        var msg = winui.window.msg,
            $ = layui.$;
        form.render();
        form.on('submit(formEditMenu)', function (data) {
            console.log(data);
            //表单验证
            if (winui.verifyForm(data.elem)) {
                layui.$.ajax({
                    type: 'post',
                    url: 'eureka/update',
                    async: false,
                    data: data.field,
                    dataType: 'json',
                    success: function (json) {
                        if (json.success) {
                            msg('修改成功', {
                                icon: 1,
                                time: 2000
                            });
                        } else {
                            msg(json.message);
                        }
                        winui.window.close('editMenu');
                    },
                    error: function (xml) {
                        msg(xml.responseText == "" ? "获取页面失败" : xml.responseText, {
                            icon: 2,
                            time: 2000
                        });
                    }
                });
            }
            return false;
        });
    });
</script>